<template>
	<view class="mPage">
		<!-- <view style="position: sticky;top: 0;z-index: 6;">
			<uni-nav-bar title="服务项目" statusBar :border="false" backgroundColor="#FFFFFF"></uni-nav-bar>
		</view> -->
		<view class="fw-list">
			<view class="fw-item" v-for="(item,index) in mList" @click="toProjectDetails(item)">
				<image class="fw-item-cover" :src="item.thumb" mode="aspectFill"></image>
				<text class="fw-title">{{item.name}}</text>
				<text class="fu-desc">{{item.remark}}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'

	import {
		navigateTo
	} from '@/utils/util.js'

	import {
		getProjectItemList
	} from '@/api/index.js'

	import {
		onLoad,
		onShareAppMessage
	} from '@dcloudio/uni-app'

	const mList = ref([])

	const store_sn = ref();
	const handleBack = () => {
		uni.navigateBack()
	}

	const getProjectData = async () => {
		let res = await getProjectItemList({
			store_sn: store_sn.value
		})
		if (res?.code) {
			console.log(res.data);
			mList.value = res.data ?? []
		}
	}

	onLoad(() => {
		store_sn.value = uni.getStorageSync("store_sn");
		console.log("store_sn=>", store_sn.value);
		getProjectData();
	})


	const toProjectDetails = (item) => {
		navigateTo({
			url: `/subpages/pages/projectDetails/index?code=${item.code}`
		})
	}
</script>

<style lang="scss" scoped>
	.fw-list {
		display: flex;
		flex-direction: row;
		width: calc(100% - 5rpx);
		margin-top: 30rpx;
		margin-bottom: 30rpx;
		margin-left: 5rpx;
		flex-wrap: wrap;

		.fw-item {
			display: flex;
			flex-direction: column;
			width: 340rpx;
			margin-left: 20rpx;
			height: 474rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			overflow: hidden;
			justify-content: space-between;

			.fw-item-cover {
				width: 100%;
				height: 339rpx;
				display: block;
				border-radius: 10rpx;
				overflow: hidden;
			}

			.fw-title {
				font-size: 30rpx;
				color: #151515;
				margin: 0 18rpx;
				font-weight: bold;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}

			.fu-desc {
				font-size: 26rpx;
				color: #2C2C2C;
				margin: 0 18rpx 33rpx 18rpx;
				font-weight: 500;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}
</style>